package com.chixing.day12_date_factory;




public class GenericDemo {
    public static  void fun1(Pointer<Integer> pointer){

    }

    public static void fun2(Pointer<String> pointer){

    }

    //？ 通配符: 可以匹配任意的泛型类型
    public static void fun3(Pointer<?> pointer){

    }

    //? extends Account:通配符上限
    public static void fun4(Pointer<? extends Account> pointer){//形参

    }

    public static void main(String[] args) {
        Pointer<Account> pointer1 = new Pointer<>();
        Pointer<SavingAccount> pointer2 = new Pointer<>();
        Pointer<CreditAccount> pointer3 = new Pointer<>();
        fun4(pointer1);
        fun4(pointer2);
        fun4(pointer3);



        Pointer<Integer> p1 = new Pointer<>();
        fun1(p1);


        Pointer<String> p2 = new Pointer<>();
        fun2(p2);

        fun3(p1);
        fun3(p2);

        Pointer<Float> p3 = new Pointer<>();
        fun3(p3);

        Pointer<Account> p4 = new Pointer<>();
        fun3(p4);


    }
}
class Account{

}

class SavingAccount extends Account{}
class CreditAccount extends Account{}
